import { PayloadAction, createSlice } from "@reduxjs/toolkit";
import { RootState } from ".";

export const cleanInfoSlice = createSlice({
  name: 'cleanInfo',
  initialState: {
    value: {
      total: 0,
      handled: 0,
    },
  },

  reducers: {
    setCleanTotal: (state, action: PayloadAction<number>) => {
      state.value.total = action.payload
    },
    setCleanHandled: (state, action: PayloadAction<number>) => {
      state.value.handled = action.payload
    },
  },
})

export const { setCleanHandled, setCleanTotal } = cleanInfoSlice.actions
export default cleanInfoSlice.reducer

export const cleanInfo = (state: RootState) => state.cleanInfo.value
